var index = new Vue({
	el: '#index',
	data: {
		count: 0
	},
	mounted: function() {
		this.beforeMount()
	},
	methods: {
		beforeMount: function() {
			//设置定时器，每10秒刷新一次
			var self = this;
			setInterval(getTotelNumber, 10000)

			function getTotelNumber() {

				self.count = 0;
				db.transaction(function(tx) {

					tx.executeSql('SELECT * FROM area group by id', [], function(tx, results) {
						if(results.rows.length != null) {
							self.count = self.count + results.rows.length;
						}
					}, null);
					tx.executeSql('SELECT * FROM info group by id', [], function(tx, results) {
						if(results.rows.length != null) {
							self.count = self.count + results.rows.length;
						}
					}, null);
				});

			}
			getTotelNumber();
		}

	},
});